package com.jeomo.sys.provider.web.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.jeomo.common.core.dto.ITree;
import com.jeomo.sys.api.enums.RoleTypeEnum;
import com.jeomo.sys.api.vo.PermissionVo;

import java.util.List;

/**
 * <h3>jeomo</h3>
 * <p>角色树</p>
 *
 * @author : qibotian
 * @date : 2020-09-28 10:33
 **/
public class RoleTreeVo implements ITree {

    /**
     * 顶级组织码
     */
    private String topOrgCode;

    /**
     * 角色代码
     */
    private String code;

    /**
     * 上级目录
     */
    private String parentCode;

    /**
     * 角色类型
     */
    private RoleTypeEnum type;

    /**
     * 角色名称
     */
    private String name;

    /**
     * 角色拥有的菜单
     */
    @TableField(exist = false)
    private List<PermissionVo> permissions;

    private List<RoleTreeVo> children;


    @Override
    public boolean isGroup() {
        return RoleTypeEnum.ROLE_GROUP.equals(getType());
    }

    @Override
    public Object getGroupTypeValue() {
        return RoleTypeEnum.ROLE_GROUP;
    }

    // ********************** getter setter **********************

    public String getTopOrgCode() {
        return topOrgCode;
    }

    public void setTopOrgCode(String topOrgCode) {
        this.topOrgCode = topOrgCode;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<PermissionVo> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<PermissionVo> permissions) {
        this.permissions = permissions;
    }

    public String getParentCode() {
        return parentCode;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    public RoleTypeEnum getType() {
        return type;
    }

    public void setType(RoleTypeEnum type) {
        this.type = type;
    }

    public List<RoleTreeVo> getChildren() {
        return children;
    }

    public void setChildren(List<RoleTreeVo> children) {
        this.children = children;
    }


}
